package br.com.nirvana.loteria.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesUtil {

	private static Properties loteriaProperties;
	private static Properties messagesProperties;

	static {
		loteriaProperties = PropertiesUtil.loadProperties("loteria.properties");
		messagesProperties = PropertiesUtil.loadProperties("messages.properties");
	}

	public static Properties loadProperties(String fileName) {
		Properties props = new Properties();
		InputStream in = null;
		try {
			in = PropertiesUtil.class.getClassLoader()
            .getResourceAsStream(fileName);

			props.load(in);
			in.close();
		} catch (IOException ex) {
			System.out.println(ex.getMessage());
			ex.printStackTrace();
		}
		return props;
	}

	public static Properties getLoteriaProperties() {
		return loteriaProperties;
	}

	public static Properties getMessagesProperties() {
		return messagesProperties;
	}
}
